package com.hitechbangla.fctu.base.radar;

import java.awt.Graphics;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class AircraftListForPath implements Serializable
{
    private List<AircraftForPath> listAircraftForPath;
    private int pathSize;
    
    public AircraftListForPath()
    {
	listAircraftForPath = new ArrayList<>();
    }
    
    
    public void addAircraft(String callSign, int positionX, int positionY)
    {	
	for(AircraftForPath aircraftForPath: listAircraftForPath)
	{
	    // // if callSign with that aircraft already exists in the list
	    if(aircraftForPath.getCallSign().equals(callSign)) 
	    {
		aircraftForPath.addLocation(positionX, positionY,pathSize);		
		//System.out.println("from aircraftlistoforpath: aircraft not added this time");
		return;
	    }
	}
	
	// if aircraft not found
	AircraftForPath aircraftForPath = new AircraftForPath();
	aircraftForPath.setCallSign(callSign);
	aircraftForPath.addLocation(positionX, positionY, pathSize);	
	listAircraftForPath.add(aircraftForPath);	
	//System.out.println("from aircraftlistoforpath: aircraft added this time");
	////System.out.println("from aircraftlistforpath: size " + listAircraftForPath.size());
    }
    
    public void draw(Graphics g)
    {
	for(AircraftForPath aircraftForPath : listAircraftForPath)
	{
	    aircraftForPath.draw(g);
	}
    }
    
    public int getPathSize() {
	return pathSize;
    }
    
    public void setPathSize(int pathSize) {
	this.pathSize = pathSize;
    }
    
    
}
